<ion-header>
  <ion-navbar>
    <ion-title>修改工单</ion-title>
  </ion-navbar>
</ion-header>

<ion-content>

  <div class="jl_list w12 font_size_large bgcolor_white mb10 border_bottom">
    <div class="jl_list_title ">
      <span class="fl font_blue">保修信息</span><span class="fr">工单状态：<span class="font_red">{{data.ZT}}</span></span>
    </div>
    <div class="jl_list_item border_bottom">
      <div class="w08 "><span class="font_gray">单据编号：</span>{{data.ID}}</div>
      <div class="w08 "><span class="font_gray">单据类型：</span>{{data.DESCRIPTION}}</div>
      <div class="w12 "><span class="font_gray">服务性质：</span>{{data.FWXZ}}
        <span class="w02 fr"><button ion-button style="height: 20px!important;"
                                     (click)="updataGuarantee()">{{data.FWXZ ? "修改" : "选择"}}</button></span>
      </div>
      <div class="w12 "><span class="font_gray">收卡状态：</span>{{data.SKZT}}
        <span class="w02 fr"><button ion-button style="height: 20px!important;"
                                     (click)="updataCard()">{{data.SKZT ? "修改" : "选择"}}</button></span>
      </div>
      <div class="w08 "><span class="font_gray">服务人员：</span>{{userInfo.USERNAME}}</div>
    </div>
    <div class="jl_list_item">
      <ng-container *ngFor="let spmx of data.codeList">
        <ng-container *ngFor="let sp of spmx.codes;let i = index">
          <div class="w12">
            <span class="w08 "><span class="font_gray">牌名型号：</span>{{spmx.EXTSKUNAME || ''}}</span>
            <!--/{{SPMX.EXTPPNAME||''}}/{{SPMX.EXTFLNAME||''}}-->
          </div>
          <div class="w12 bgcolor_white">
            <ng-container *ngFor="let v of sp">
              <ng-container *ngIf="v.lx=='1'">
                <div class="w12">
                  <span class="w08 "><span class="font_gray">外机编号：</span>{{v.code}}</span>
                  <span class="w02"><button class="fa fa-camera" ion-button style="height: 20px!important;"
                                            (click)="scanBM(v)"></button></span>
                  <span class="w02"><button ion-button style="height: 20px!important;"
                                            (click)="imputBM(v)">输入</button></span>
                </div>
              </ng-container>
              <ng-container *ngIf="v.lx=='2'">
                <div class="w12">
                  <span class="w08 "><span class="font_gray">内机编号：</span>{{v.code}}</span>
                  <span class="w02"><button class="fa fa-camera" ion-button style="height: 20px!important;"
                                            (click)="scanBM(v)"></button></span>
                  <span class="w02"><button ion-button style="height: 20px!important;"
                                            (click)="imputBM(v)">输入</button></span>
                </div>
              </ng-container>
              <ng-container *ngIf="v.lx=='3'">
                <div class="w12">
                  <span class="w08 "><span class="font_gray">条码：</span>{{v.code}}</span>
                  <span class="w02"><button class="fa fa-camera" ion-button style="height: 20px!important;"
                                            (click)="scanBM(v)"></button></span>
                  <span class="w02"><button ion-button style="height: 20px!important;"
                                            (click)="imputBM(v)">输入</button></span>
                </div>
              </ng-container>
            </ng-container>
          </div>
        </ng-container>
      </ng-container>

      <!--<span class="w12">
        <span class="w08 fl"><span class="font_gray">报修故障：</span>安装</span>
        <span class="w02 fr"><button ion-button style="height: 20px!important;">输入</button></span>
      </span>-->
      <div class="w08 " *ngIf="data.GZSC"><span class="font_gray">销售单位：</span>{{data.GZSC || ''}}</div>
      <div class="w08 "><span class="font_gray">信息来源：</span>金力</div>
      <div class="w08 " *ngIf="data.ORDERID"><span class="font_gray">工作单号：</span>{{data.ORDERID || ''}}</div>
      <div class="w12 ">
        <div class="w08"><span class="font_gray">预约时间：</span>{{data.YYRQ}}</div>
        <div class="w02 fr">
          <ion-datetime style="font-size: 0 ;position: relative" id="yysj"  class=" item fl tc" displayFormat="YYYY-MM-DD" pickerFormat="YYYY-MM-DD" min="{{ min }}"
                      max="{{ max }}" doneText="确定" cancelText="取消" [(ngModel)]="data.YYRQ"></ion-datetime>
          <button ion-button style="height: 20px!important;" (click)="updataYYSJ()">更改</button>
        </div>
      </div>
      <div class="w08 "><span class="font_gray">接单日期：</span>{{data.DISPATCHED || ''}}</div>
      <div class="w08 "><span class="font_gray">购机日期：</span>{{data.JDRQ || ''}}</div>
      <div class="w12">
        <span class="w08 "><span class="font_gray">备注：</span>{{data.BZ || ''}}</span>
        <span class="w02 fr"><button ion-button style="height: 20px!important;"
                                     (click)="addRemarks()">添加</button></span>
      </div>
    </div>
  </div>
  <div class="jl_list w12 font_size_large bgcolor_white mb10 border_bottom">
    <div class="jl_list_title ">
      <span class="fl font_blue">客户信息</span>
    </div>
    <div class="jl_list_item border_bottom">
      <div class="w12">
        <span class="w08 "><span class="font_gray">客户姓名：</span>{{data.NAME || ''}}</span>
        <span class="w02 fr"><button ion-button
                                     style="height: 20px!important;"
                                     (click)="updataName()">{{data.NAME ? "修改" : "输入"}}</button></span>
      </div>
      <!-- <ng-container *ngIf="data.DHLB">
         <ng-container  *ngFor="let DH of data.DHLB">
           <span class="w12">
             <span class="w08 "><span class="font_gray">用户手机：</span>{{DH||''}}</span>
             <span class="w02 fr"><button ion-button style="height: 20px!important;" (click)="upgradeContact()">修改</button></span>
           </span>
         </ng-container>
       </ng-container>-->
        <div class="w12">
          <span class="w08 "><span class="font_gray">客户手机：</span>{{data.MOBILE || ''}}</span>
          <span class="w02 fr"><button ion-button style="height: 20px!important;"
                                       (click)="updataContact()">{{data.MOBILE ? "修改" : "输入"}}</button></span>
        </div>
      <div class="w12">
        <span class="w08 "><span class="font_gray">客户地址：</span>{{data.ADDRESS || ''}}</span>
        <span class="w02 fr"><button ion-button style="height: 20px!important;"
                                     (click)="updataAddress()">{{data.ADDRESS ? "修改" : "输入"}}</button></span>
      </div>
      <div class="w12">
        <span class="w08 "><span class="font_gray">楼层：</span>{{data.floor || ''}}</span>
        <span class="w02 fr"><button ion-button style="height: 20px!important;"
                                     (click)="updataFoolernum()">{{data.floor ? "修改" : "输入"}}</button></span>
      </div>
      <div class="w12">
        <span class="w08 "><span class="font_gray">是否有电梯：</span>{{data.lift?"是":"否"}}</span>
        <span class="w02 fr">
          <ion-toggle class="fr"  [(ngModel)]="data.lift"></ion-toggle>
        </span>
      </div>
    </div>
  </div>
  <div class="jl_list w12 font_size_large bgcolor_white mb10 border_bottom"
       *ngIf="data.DESCRIPTION=='维修'">
    <div class="jl_list_title ">
      <span class="fl font_blue">维修信息</span>
    </div>
    <div class="jl_list_item border_bottom">
      <div class="w12">
        <span class="w08 "><span class="font_gray">故障原因：</span>{{data.GZYY}}</span>
        <span class="w02 fr"><button ion-button style="height: 20px!important;"
                                     (click)="updataCauses()">{{data.GZYY ? "修改" : "选择"}}</button></span>
      </div>
      <div class="w12">
        <span class="w08 "><span class="font_gray">维修措施：</span>{{data.WXCS}}</span>
        <span class="w02 fr"><button ion-button style="height: 20px!important;"
                                     (click)="updataServiceType()">{{data.WXCS? "修改" : "选择"}}</button></span>
      </div>
      <!--<span class="w12">
        <span class="w08 "><span class="font_gray">超期原因：</span>天气不好</span>
        <span class="w02 fr"><button ion-button style="height: 20px!important;">输入</button></span>
      </span>
      <span class="w12">
        <span class="w08 "><span class="font_gray">收用户费：</span>1000￥</span>
        <span class="w02 fr"><button ion-button style="height: 20px!important;">输入</button></span>
      </span>-->
    </div>
  </div>

  <div class="jl_list w12 font_size_large bgcolor_white mb10 border_bottom">
    <div class="jl_list_title ">
      <span class="fl font_blue">图片</span>
    </div>
    <div class="jl_list_item border_bottom">
      <image-picker class="fl up_img" [mode]="'all'"
                    [(ngModel)]="picList"
                    [upload]="true"
                    [isFileServer]="true"
                    (addEvent)="imageUpload($event)"
                    (delEvent)="delImage($event)">
      </image-picker>
    </div>
  </div>

</ion-content>
<ion-footer>
  <div class="w12 bgcolor_white tr ">
    <span ><button ion-button (click)="saveData()" style="width: 120px">保存</button></span>
    <!--<span class="w06 tc"><button ion-button (click)="finalSeaveData()" style="width: 120px">完工保存</button></span>-->
  </div>
</ion-footer>
